package com.example.soft.demos.web;

import java.util.HashSet;

// 统计学生数量的访问者
public class CountStudentsVisitor implements PaperSelectionVisitor {
    private int studentCount;

    @Override
    public void visit(PaperSelection paperSelection) {
        // 使用HashSet去重
        studentCount = new HashSet<>(paperSelection.getSelections().values()).size();
    }

    public int getStudentCount() {
        return studentCount;
    }
}
